package org.inspursc.s0517.health.evaluation.service.impl;

import org.inspursc.s0517.health.evaluation.dao.QuRadioDao;
import org.inspursc.s0517.health.evaluation.entity.QuRadio;
import org.inspursc.s0517.health.evaluation.service.QuRadioService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

/**
 * @author B_Dream
 * @date 2018/5/21 17:17
 */
@Service
public class QuRadioServiceImpl implements QuRadioService {


    @Autowired
    private QuRadioDao quRadioDao;


    @Override
    public boolean saveRadio(QuRadio quRadio) {

        try {
            quRadioDao.save(quRadio);
            return true;
        } catch (Exception e) {
            return false;
        }

    }

    @Override
    public List<QuRadio> findByQuId(Integer quId) {
        return quRadioDao.findByQuId(quId);
    }


    @Override
    public void deleteByquId(Integer quId) {
        quRadioDao.deleteAllByQuId(quId);
    }


    @Override
    public void deleteBatch(List<QuRadio> quRadios) {
        quRadioDao.deleteAll(quRadios);
    }

    @Override
    public List<QuRadio> saveBatchRadio(List<QuRadio> radios) {
        return quRadioDao.saveAll(radios);
    }
}
